package bdz.projects.atwww.electrolux.views.digital
{
	import bdz.projects.atwww.electrolux.ui.ELProgressControl;
	
	import flash.text.TextField;

	public class ELDigitalProgressControl extends ELProgressControl
	{
		private var _timer:TextField;
		private var _timer2:TextField;
		public function ELDigitalProgressControl()	{
			super();
		}
		override protected function initializeComponent():void{
			_timer = this["timer"];
			_timer2 = this["timer2"] || null;
		}
		override public function set time(n:Number):void{
			
			var secs:Number = (n*60);
			var min:Number = Math.floor(secs/60);
			var hr:Number = Math.floor(min/60);
			
			secs %= 60;
			min %= 60;
			hr %= 24;
			
			var ssecs:String = secs < 10 ? "0"+secs : String(secs);
			var smin:String = min < 10 ? "0"+min : String(min);
			var shr:String = hr < 10 ? "0"+hr : String(hr);
			
			_timer.text = shr+":"+smin;
			if(_timer2){
				_timer2.text = _timer.text;
			}
			
		}
		
	}
}